﻿using AAA.Base.Util.Reader;

namespace AAA.Command.WCF
{
    public class ReturnCode
    {
        private static ReturnCode _returnCode;
        private IniReader _iniConfig;

        public static ReturnCode Config()
        {
            if (_returnCode == null)
                _returnCode = new ReturnCode();
            return _returnCode;
        }

        public void Init(string strConfigName)
        {
            _iniConfig = new IniReader(strConfigName);
        }

        public void Init(string strDllFilename, string strFilename)
        {
            _iniConfig = new IniReader(strDllFilename, strFilename);
        }

        public string GetMessage(string strCode)
        {
            return _iniConfig.GetParam(strCode) != null
                    ? _iniConfig.GetParam(strCode)
                    : "";
        }
    }
}
